//
//  StatusBottomView.m
//  weibo110
//
//  Created by 臧松 on 15/12/31.
//  Copyright © 2015年 臧松. All rights reserved.
//

#import "StatusBottomView.h"
#import "UIButton+Extension.h"
#import "Masonry.h"
@interface StatusBottomView ()
//转发按钮
@property (nonatomic,strong) UIButton * retweetedButton;
// 评论按钮
@property (nonatomic,strong) UIButton * commentButton;
// 点赞按钮
@property (nonatomic,strong) UIButton * likeButton;
// 分割视图
@property (nonatomic,strong) UIView * sepView1;
@property (nonatomic,strong) UIView * sepView2;



@end
@implementation StatusBottomView
// 懒加载控件
-(UIButton *)retweetedButton{
    if (_retweetedButton == nil) {
        
        _retweetedButton = [UIButton btnWithTitle:@" 转发" color:[UIColor darkGrayColor] imageName:@"timeline_icon_retweet" fontSize:12];
    }
    return _retweetedButton;
}
-(UIButton *)commentButton{
    
    if (_commentButton == nil) {
        
        _commentButton = [UIButton btnWithTitle:@" 评论" color:[UIColor darkGrayColor] imageName:@"timeline_icon_comment" fontSize:12];
    }
    return _commentButton;
}
-(UIButton *)likeButton{
    
    if (_likeButton == nil) {
        
        _likeButton = [UIButton btnWithTitle:@" 赞" color:[UIColor darkGrayColor] imageName:@"timeline_icon_unlike" fontSize:12];
    }
    return _likeButton;
}
-(UIView *)sepView1{
    if (_sepView1 == nil) {
        _sepView1 = [[UIView alloc]init];
        _sepView1.backgroundColor = [UIColor darkGrayColor];
    }
    return _sepView1;
}
-(UIView *)sepView2{
    if (_sepView2 == nil) {
        _sepView2 = [[UIView alloc]init];
        _sepView2.backgroundColor = [UIColor darkGrayColor];
    }
    return _sepView2;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupUI];
        self.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
    }
    return self;
}
// MARK: - 设置界面
-(void)setupUI{
    
    // 1. 添加控件
    [self addSubview:self.retweetedButton];
    [self addSubview:self.commentButton];
    [self addSubview:self.likeButton];
    [self addSubview:self.sepView2];
    [self addSubview:self.sepView1];
    // 2. 自动布局
    [self.retweetedButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(self.mas_left);
        make.bottom.equalTo(self.mas_bottom);
    }];
    
    [self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.retweetedButton.mas_top);
        make.left.equalTo(self.retweetedButton.mas_right);
        make.height.equalTo(self.retweetedButton.mas_height);
        make.width.equalTo(self.retweetedButton.mas_width);
    }];
    [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.commentButton.mas_top);
        make.left.equalTo(self.commentButton.mas_right);
        make.height.equalTo(self.commentButton.mas_height);
        make.width.equalTo(self.commentButton.mas_width);
        
        make.right.equalTo(self.mas_right);
    }];
    
    // 分割视图布局
   
    [self.sepView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.retweetedButton.mas_right);
        make.centerY.equalTo(self.retweetedButton.mas_centerY);
        make.width.equalTo(@0.5);
        make.height.equalTo(self.retweetedButton.mas_height).multipliedBy(0.4);
        
    }];
    [self.sepView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.commentButton.mas_right);
        make.centerY.equalTo(self.commentButton.mas_centerY);
        make.width.equalTo(@0.5);
        make.height.equalTo(self.commentButton.mas_height).multipliedBy(0.4);
    }];
    
}
@end
